<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:o="http://omnifaces.org/ui"
                template="/WEB-INF/layout/template.xhtml">

    <ui:define name="content">
        <!--<o:importConstants type="com.example.model.Role" />-->

        <h2>登记用户</h2>
        <h:form id="register">
            <h:panelGrid columns="3">
                <p:outputLabel for="username" value="用户：" />
                <p:inputText id="username"
                             value="#{registerUser.user.username}"
                             required="true"
                             requiredMessage="必须输入用户名">
                    <f:ajax event="blur" render="m_username" />
                </p:inputText>
                <h:message id="m_username" for="username" />

                <p:outputLabel for="password" value="口令：" />
                <p:password id="password"
                            value="#{registerUser.user.password}"
                            required="true"
                            requiredMessage="必须输入口令">
                    <f:ajax event="blur" render="m_password" />
                </p:password>
                <h:message id="m_password" for="password" />

                <p:outputLabel for="realName" value="真实姓名：" />
                <p:inputText id="realName"
                             value="#{registerUser.user.realName}"
                             required="true"
                             requiredMessage="必须输入真实姓名">
                    <f:ajax event="blur" render="m_realName" />
                </p:inputText>
                <h:message id="m_realName" for="realName" />

                <!--p:outputLabel for="roles" value="角色：" />
                <p:selectManyCheckbox id="roles" value="#{registerUser.user.roles}" required="true"
                                      layout="pageDirection" converter="omnifaces.GenericEnumConverter">
                    <f:selectItems value="#{Role}" />
                </p:selectManyCheckbox>
                <h:message id="m_roles" for="roles" /-->

                <h:panelGroup />
                <p:commandButton value="登记"
                                 action="#{registerUser.submit}"
                                 update="@form"/>
                <h:messages globalOnly="true" layout="table" />
            </h:panelGrid>
        </h:form>
    </ui:define>
</ui:composition>
